package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sc.nft.entity.vo.AdminReportBalanceVO;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.ReportBalance;
import com.sc.nft.mapper.ReportBalanceMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * (sc_report_balance)数据DAO
 *
 * @author Sun
 * @since 2023-02-16 15:00:22
 * @description 由 Mybatisplus Code Generator 创建
 */
@Slf4j
@Repository
public class ReportBalanceDao extends ServiceImpl<ReportBalanceMapper, ReportBalance> {

    public ReportBalance getLastOneDay() {
        LambdaQueryWrapper<ReportBalance> wrapper = new LambdaQueryWrapper<>();
        wrapper.last("order by id desc limit 1");
        return getOne(wrapper);
    }

    public Boolean getByTime(String time) {
        List<ReportBalance> list = baseMapper.getByTime(time);
        if(list.size() >0){
            return Boolean.TRUE;
        }
        return Boolean.FALSE;
    }
}